package com.example.user.service.impl;

import com.example.user.service.PropertyService;
import entity.ServerResponseBody;
import mapper.UserMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import vo.PropertyVo;

import java.util.List;

/**
 * @BelongsProject: gxcwhd
 * @BelongsPackage: com.example.user.service.impl
 * @Author: huan
 * @CreateTime: 2020-08-18 20:18
 * @Description:
 */
@Service
@Transactional
public class PropertyServiceImpl implements PropertyService {

    @Autowired
    private UserMapper userMapper;

    @Override
    @Transactional(readOnly = true)
    public ServerResponseBody getAllProperty() {
        List<PropertyVo> properties = userMapper.getAllProperty();

        if(properties == null){
            return ServerResponseBody.fail();
        }

        return ServerResponseBody.success(properties);
    }
}
